﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DCT.CodeBox.TaskManager.Codes
{
    /*
     事件定义
     */

    public class TaskDispatcherEventArg
    {
        public TaskDispatcher Sender { get; private set; }

        public TaskDispatcherEventArg(TaskDispatcher sender)
        {
            this.Sender = sender;
        }
    }

    public class TaskDispatcherStatusChangedEventArg : TaskDispatcherEventArg
    {
        public TaskDispatcherStatus OldStatus { get; private set; }
        public TaskDispatcherStatus NewStatus { get; private set; }
        public TaskDispatcherStatusChangedEventArg(TaskDispatcher sender
            , TaskDispatcherStatus oldStatus
            , TaskDispatcherStatus newStatus)
            : base(sender)
        {
            this.OldStatus = oldStatus;
            this.NewStatus = newStatus;
        }
    }

    public class TaskItemWrapperEventArg : TaskDispatcherEventArg
    {
        public TaskItemWrapper ItemWrapper { get; private set; }
        public TaskItemWrapperEventArg(TaskDispatcher sender
            , TaskItemWrapper wrapper)
            : base(sender)
        {
            this.ItemWrapper = wrapper;
        }
    }

    public class TaskItemEventArg : TaskDispatcherEventArg
    {
        public ITaskItem Item { get; private set; }
        public TaskItemEventArg(TaskDispatcher sender
            , ITaskItem item)
            : base(sender)
        {
            this.Item = item;
        }
    }

    public class TaskItemWithExceptionEventArg : TaskItemEventArg
    {
        public Exception Exception { get; private set; }
        public TaskItemWithExceptionEventArg(TaskDispatcher sender
            , ITaskItem item
            , Exception exception)
            : base(sender, item)
        {
            this.Exception = exception;
        }
    }
}
